#! /bin/bash
DIRECTORY_TO_OBSERVE=/home/wzq/tmp/1.js   
function block_for_change {
  inotifywait -r \
    -e modify,move,create,delete \
    $DIRECTORY_TO_OBSERVE
}
BUILD_SCRIPT=/home/wzq/tmp/1.sh
function build {
  echo haha
  bash $BUILD_SCRIPT
}
#build
while block_for_change; do
  build
done
